package com.ruoyi.question.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.question.mapper.QueQuestionsMapper;
import com.ruoyi.question.domain.QueQuestions;
import com.ruoyi.question.service.IQueQuestionsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 题库管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-02-14
 */
@Service
public class QueQuestionsServiceImpl implements IQueQuestionsService 
{
    @Autowired
    private QueQuestionsMapper queQuestionsMapper;

    /**
     * 查询题库管理
     * 
     * @param id 题库管理主键
     * @return 题库管理
     */
    @Override
    public QueQuestions selectQueQuestionsById(String id)
    {
        return queQuestionsMapper.selectQueQuestionsById(id);
    }

    /**
     * 查询题库管理列表
     * 
     * @param queQuestions 题库管理
     * @return 题库管理
     */
    @Override
    public List<QueQuestions> selectQueQuestionsList(QueQuestions queQuestions)
    {
        return queQuestionsMapper.selectQueQuestionsList(queQuestions);
    }

    /**
     * 新增题库管理
     * 
     * @param queQuestions 题库管理
     * @return 结果
     */
    @Override
    public int insertQueQuestions(QueQuestions queQuestions)
    {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        queQuestions.setId(uuid);

        Date date = new Date();
        queQuestions.setCreatedAt(date);
        queQuestions.setUpdatedAt(date);

        return queQuestionsMapper.insertQueQuestions(queQuestions);
    }

    /**
     * 修改题库管理
     * 
     * @param queQuestions 题库管理
     * @return 结果
     */
    @Override
    public int updateQueQuestions(QueQuestions queQuestions)
    {
        return queQuestionsMapper.updateQueQuestions(queQuestions);
    }

    /**
     * 批量删除题库管理
     * 
     * @param ids 需要删除的题库管理主键
     * @return 结果
     */
    @Override
    public int deleteQueQuestionsByIds(String ids)
    {
        return queQuestionsMapper.deleteQueQuestionsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除题库管理信息
     * 
     * @param id 题库管理主键
     * @return 结果
     */
    @Override
    public int deleteQueQuestionsById(String id)
    {
        return queQuestionsMapper.deleteQueQuestionsById(id);
    }
}
